package com.ybzl.mini.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ybzl.common.core.controller.BaseController;
import com.ybzl.common.core.page.PageData;
import com.ybzl.mini.entity.MiniFankui;
import com.ybzl.mini.mapper.MiniFankuiMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*;


/*
 * Desc：一意见反馈
 * @Author jiaxin
 * @Company asiainfo.com
 * @Since  2024-06-29 10:44:56.540
 *
 */

@Slf4j
@RestController
@RequestMapping("/miniFankui")
public class MiniFankuiController extends BaseController {

    @Autowired
    private MiniFankuiMapper fankuiMapper;


    /**
     * 查询 MiniWenzhang 列表，模糊查询
     *
     * @param MiniFankui fankui
     * @return data data
     */
    @PostMapping("/list")
    public PageData list(@RequestBody MiniFankui fankui) {
        startPage();
        LambdaQueryWrapper<MiniFankui> query = new LambdaQueryWrapper<>();
        query.orderByDesc(MiniFankui::getTime);
        if (!ObjectUtils.isEmpty(fankui.getUsername())) {
            query.eq(MiniFankui::getUsername, fankui.getUsername());
        }
        if (!ObjectUtils.isEmpty(fankui.getNickName())) {
            query.eq(MiniFankui::getNickName, fankui.getNickName());
        }
        return getDataTable(fankuiMapper.selectList(query));
    }

}
